import "./assets/main.css";

import { createApp } from "vue";
import { createPinia } from "pinia";
import Cookies from "js-cookie";

import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import locale from "element-plus/es/locale/lang/zh-cn";
import App from "./App.vue";
import router from "./router";
import { useDict } from "@/utils/dict";
import store from "./store";
import SvgIcon from "@/components/SvgIcon";
import elementIcons from "@/components/SvgIcon/svgicon";
import { setToken } from "./utils/auth";

const app = createApp(App);
app.config.globalProperties.useDict = useDict;
setToken(Cookies.get("Z-Token"));
app.use(createPinia());
app.use(router);
app.use(store);
app.use(elementIcons);

app.component("svg-icon", SvgIcon);

// 使用element-plus 并且设置全局的大小
app.use(ElementPlus, {
  locale: locale,
  // 支持 large、default、small
  size: Cookies.get("size") || "default",
});
app.mount("#app");
